package dataset

import (
	"gitee.com/kordar/goadmin/admin/middleware"
	"github.com/gin-gonic/gin"
	digstarter "github.com/kordar/dig-starter"
	ginsys_starter "github.com/kordar/ginsys-starter"
	middleware2 "github.com/kordar/ginsys/middleware"
	"go.uber.org/dig"
	datasetInject "labelsys/dataset/inject"
)

func routerProvider() {
	digstarter.ProvideE(func() (func(router *gin.Engine), error) {
		return Router, nil
	}, dig.Group(ginsys_starter.RouterIocGroup.Value()))
}

func Router(router *gin.Engine) {
	group := router.Group("/")
	digstarter.InvokeE(func(p datasetInject.RouterParams) {

		group.Use(middleware2.RecoveryMiddleware(), middleware.AdminAuth(p.AdminRepos, p.Rbac.GetAuthManager()))
		{
			router.POST("/dataset/upload", p.DatasetCtrl.Upload)
		}
	})
}
